package com.zh.mediacommon.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class CheckInformation {
    public static boolean isIDNumber(String IDNumber) {
        String regularExpression = "(^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$)|" +
                "(^[1-9]\\d{5}\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}$)";
        return IDNumber.matches(regularExpression);
    }
    public static boolean isValidPhoneNumber(String phoneNumber) {
        String regex = "^1[3-9]\\d{9}$";
        Pattern pattern = Pattern.compile(regex);
        Matcher matcher = pattern.matcher(phoneNumber);
        return matcher.matches();
    }
    public static boolean checkPassword(String password, String confirmPassword){
        return password.equals(confirmPassword);
    }

    public static boolean isCharacterAndNumber(String password) {
        String pattern = "^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,}$";
        return Pattern.matches(pattern, password);
    }
}
